//
//  StageManager.h
//  CandyJump
//
//  Created by Bon Lam on 19/03/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@class Model;
@class Character;
//===============================================================================
@protocol StageManagerDelegate <NSObject>

- (Character*)character;
- (int)currentheight;
- (void)addStageObject:(Model*)model;
- (void)removeStageObject:(Model*)model;
- (void)removeAllStageObjects;

@optional

@end

#pragma mark -

//	Class for manageing objects on the map, (including generating objects)
//=====================================================================================================================
@class GameScene;
@interface StageManager : NSObject {

	NSMutableArray	*modelArray;				//	All objects in the map, including the character and all items
	NSMutableArray	*backgroundModelArray;		//	Background objects, for decoration only
	
	GameScene	*delegate;		//	Weak reference
	
	float maxHeight;			//	Max. height of the objects
}

//---------------------------------------------------------------------------------------------------------------------
@property (nonatomic, readonly, retain) NSMutableArray *modelArray;
@property (nonatomic, readonly, retain) NSMutableArray *backgroundModelArray;

#pragma mark Singleton Object Functions
- (id)init;
- (void)dealloc;
+ (id)allocWithZone:(NSZone *)zone;
- (id)copyWithZone:(NSZone *)zone;
- (id)retain;
- (NSUInteger)retainCount;
- (void)release;
- (id)autorelease;

#pragma mark Custom Functions
+ (StageManager *)sharedManager;
- (void)setDelegate:(id)del;

#pragma mark Objects
- (void)manageObjects;
- (NSArray*)generateObjects;		//	Return a array containing newly generated objects

#pragma mark Background
- (void)loadBackgroundWithName:(NSString*)backgroundName;
- (void)manageBackground;

@end
